package cn.javabb.controller;

import cn.javabb.common.entity.Student;
import cn.javabb.service.StudentClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;
import java.util.Map;

/**
 * @desc:
 * @author: javabb (javabob(a)163.com)
 * @create: 2020/05/28 22:06
 */
@RestController
@RequestMapping("/student")
public class StudentConsumerController {

    @Autowired
    private StudentClientService studentClientService;

    @GetMapping("/all")
    public Object queryAll() {
        return studentClientService.all();
    }

    @PostMapping("/save")
    public Object save(Student student) {
        return studentClientService.save(student);
    }

    @GetMapping("/query/{id}")
    public Object queryone(@PathVariable("id") Integer id) {
        return studentClientService.query(id);
    }

    @GetMapping("/delete/{id}")
    public Object delete(@PathVariable("id") Integer id) {
        return studentClientService.delete(id);
    }

    @GetMapping("/getInfo")
    @ResponseBody
    public Map<String,Object> getInfo() throws InterruptedException {
        return studentClientService.getInfo();
    }
}
